package class202205.demo10.demo09;

import java.util.Arrays;

public class TestDemo0 {
    public static void fuc1(int[]array){
        array = new int[]{1,2,3};
    }
    public static void fuc2(int[]array){
        array[0]=99;
    }
    public static void main1(String[] args) {
        int[] array={5,6,7};
        fuc1(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();

        fuc2(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();
    }
       /* public static int[] test(){
            int[] array = {1,2,3,4,5,6};
            return array;
        }
        public static void main2(String[] args) {
            int[] ret = test();
            System.out.println(Arrays.toString(ret));
        }*/
    public static String my_toString(int[] array){
        String ret = "[";
        for (int i = 0; i < array.length; i++) {
            ret +=array[i];
            if(i==array.length - 1) {
                break;
            }else {
                ret +=",";
            }
        }
        ret+="]";
        return ret;
    }

    public static void main(String[] args) {
        int[] array = {4,6,12,8,14,16};
        String stem = my_toString(array);
        System.out.println(stem);
    }
}
